package zimoch.mordheim.unused;

import java.util.ArrayList;
import java.util.List;

import zimoch.mordheim.Unit;



public class UnitPack {
	String nameOfPack;
	int numberOfUnits;
	private List<Unit> units;
	UnitPack()
	{
		numberOfUnits = 0;
		units = new ArrayList<Unit>();
	}
	
	UnitPack getAttackingUnit()
	{
		UnitPack attackingUnits = new UnitPack();
		for(Unit unitTest:units)
		{
			if(unitTest.isAttacking)
				attackingUnits.add(unitTest);
				
		}
		return attackingUnits;
	}
	UnitPack getDefendingUnit()
	{
		UnitPack defendingUnits = new UnitPack();
		for(Unit unitTest:units)
		{
			if(!unitTest.isAttacking)
				defendingUnits.add(unitTest);
				
		}
		return defendingUnits;
	}
	void add(Unit u)
	{
		units.add(u);
		numberOfUnits++;
	}
	boolean remove(Unit u)
	{
		if(units.remove(u))
				{
				
				numberOfUnits--;
				return true;
				}
		else
			return false;
	}
}
